package main

import "fmt"

type City struct {
	name  string
	value int
}
type Country struct {
	name string
}
type Printable interface {
	PrintStr()
}

func (c *City) PrintStr() {
	fmt.Println("city:", c.name)
}
func (c *Country) PrintStr() {
	fmt.Println("country:", c.name)

}
func main() {
	c1 := Country{"china"}
	c2 := City{"Beijing", 1}
	var list = []Printable{&c1, &c2}
	for _, v := range list {
		v.PrintStr()
	}
}
